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

Proposal: refactor dxSetTexturePixels #3052

Open
1 task done
CrosRoad95 opened this issue Jun 1, 2023 · 0 comments
Open
1 task done

Proposal: refactor dxSetTexturePixels #3052

CrosRoad95 opened this issue Jun 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@CrosRoad95
Copy link
Contributor

Is your feature request related to a problem? Please describe.

dxSetTexturePixels is slow

Describe the solution you'd like

refactor it in following way:

  1. add function to get "Image", it will be a texture representation in the ram, in practice it will be act like "download image from gpu"
  2. add DxSetImagePixels() with same syntax but with image at 1-st argument, it will effectivly do simple memset which is way way faster than what dxSetTexturePixel does
  3. add function to upload image back to texture

Image will be basicly an array of byte in memory

local texture = dxCreateTexture(128, 128)
local image = dxGetTextureImage(texture)
dxSetTexturePixels(image, ...) -- simple memset under the hood
dxSetTextureImage(texture, image)

simillar api is used in most of graphics engines, "image" sitting in ram, "texture" on gpu

if you want to set single, few pixels it can be still faster to use "setTexturePixels", but if you want to change 1000 of them than it will make significant difference.

Describe alternatives you've considered

/

Additional context

https://ogrecave.github.io/ogre-next/api/2.2/class_ogre_1_1_image2.html#details

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@CrosRoad95 CrosRoad95 added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant