ebiten: internal/graphicsdriver/directx: crash when creating too many internal textures

I tried to update my project to use the newest 2.3.x version of Ebiten (coming from 2.2.x), however I am getting the following error which crashes out before it can fully load the window, when trying to run on Windows 10:

directx: ID3D12Device::CreateCommittedResource failed: The parameter is incorrect.

The weird thing is that the new version works against the older code in the main branch, but I’ve got a lot of new features I’ve been working in a feature branch off to the side where it is failing only with the newer versions (raycast_collision).

Reproduce steps:

  1. Download the Zip from this commit SHA: https://github.com/harbdog/raycaster-go/tree/6e4aa60fd9328d1ff1c6e39c968829035c2ec6d2
  2. Download modules: go mod download
  3. Run to verify works against previous version of Ebiten: go run raycast.go
  4. Exit the game by holding CTRL key to unlock mouse from window to close it.
  5. Update Ebiten: go get github.com/hajimehoshi/ebiten/v2@v2.3.2
  6. Run again to see error: go run raycast.go

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (27 by maintainers)

Most upvoted comments

The main difference I can tell as far as ebitengine is concerned was the addition of an extremely large sprite sheet (2.2MB, 19200x300), which I was planning to optimize by making it smaller anyway so will give that a try.

Yeah, I think that’s the cause. What was the exact error message by the way? Is the error message still only directx: ID3D12Device::CreateCommittedResource failed: The parameter is incorrect.? If so, I’d have to make the message more user-friendly…

yes that’s the only error I got

Additionally when I left click to trigger the “projectile” to fire, which is the sprite that comes from the very large sheet in question, it causes massive slowdown until it finally is removed.

My guess is that separating the images increased the number of draw calls. You can confirm this with -tags=ebitendebug.

Do you really need whole the image at one time? Would it be possible to edit your sprite sheet so that only necessary part are on one sheet?

I could (and should anyway) optimize the sprite used as a projectile, it’s only that big because that’s the exact size it was from the resource I obtained it from (opengameart.org). But it’s in a sheet because it’s an animated sprite with multiple frames.

When the animated sprite is loaded from a sheet I pre-generate each frame using subImage and store each in an index array for looping the animation. https://github.com/harbdog/raycaster-go/blob/raycast_collision/engine/model/sprite.go#L230