Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix locked array error on texture cleanup #388

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

adrianbielsa1
Copy link

@adrianbielsa1 adrianbielsa1 commented Nov 13, 2024

Issue relacionado: ao-org/argentum-online-server#578.

En los logs podemos ver que uno de los problemas es que se intenta modificar el array mientras está en uso; esto es porque los bloques With toman una referencia del arreglo (en este caso surfaceEntry), el cual más adelante (en RemoveLRU) estamos intentando redimensionar.

Por otro lado, no hay ninguna razón* para usar D3DPOOL_DEFAULT en lugar de D3DPOOL_MANAGED (referencia), así que lo cambié en los lugares que se estaba usando.

* En el caso de las texturas. Para los vertex buffers e index buffers, como usan D3DUSAGE_DYNAMIC, no se puede.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

No scoreable code touched

View detailed results in CodeScene

@ao-20
Copy link
Contributor

ao-20 commented Nov 13, 2024

Fellow citizen of Nix, one of the admins verify this pull request

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

No scoreable code touched

View detailed results in CodeScene

…pth stencils since it's probably more performant
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

No scoreable code touched

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

No scoreable code touched

View detailed results in CodeScene

@@ -271,7 +289,7 @@ End Sub
Public Function CreateTextureFromData(ByRef Bytes() As Byte, ByVal Size As Long, ByVal Width As Long, ByVal Height As Long) As Direct3DTexture8
On Error GoTo ErrHandler
Dim Texture As Direct3DTexture8
Set Texture = mD3D.CreateTextureFromFileInMemoryEx(device, Bytes(0), UBound(Bytes) + 1, Width, Height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, D3DX_FILTER_LINEAR, D3DX_FILTER_LINEAR, &HFF000000, ByVal 0, ByVal 0)
Set Texture = mD3D.CreateTextureFromFileInMemoryEx(device, Bytes(0), UBound(Bytes) + 1, Width, Height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_LINEAR, D3DX_FILTER_LINEAR, &HFF000000, ByVal 0, ByVal 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hay que primero llamar mD3D.CreateTextureFromFileInMemoryEx( ... D3DPOOL_DEFAULT)

y si eso falla llamar con mD3D.CreateTextureFromFileInMemoryEx( ... D3DPOOL_MANAGED)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morgolock cuál sería el razonamiento de esta sugerencia?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants