Compare commits

..

No commits in common. "887705969f613ac9cbff3b7fee0175dd2174d52d" and "a3d193516c8adf4ff4e47330ceea4f97d8080a15" have entirely different histories.

3 changed files with 15 additions and 16 deletions

8
flake.lock generated
View File

@ -20,16 +20,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1709953752,
"narHash": "sha256-LW84B4vM1cn7E6cDNQn2LndT9iJXI1dRE5fwbNFbQa8=",
"lastModified": 1694553957,
"narHash": "sha256-8o15HEax53lBJjjcr5VHMpuuT6vBcrzSNB6y2iGlPaU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fcaa81ed3c273237217330cf342ef1873b77c80a",
"rev": "e7fe745d22df5fa282b321e577fe18d4f62e0f0b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.11",
"ref": "release-23.05",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -4,7 +4,7 @@
# append '.?submodules=1' to the nix commands.
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
flake-utils.url = "github:numtide/flake-utils";
};

View File

@ -4,8 +4,6 @@
#include <cstdint>
#include <cstring>
#include <iostream>
SDLRendererTextureUploader::SDLRendererTextureUploader(SDL_Renderer* renderer_) :
renderer(renderer_)
{
@ -21,15 +19,16 @@ uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t wi
);
assert(surf); // TODO: add error reporting
SDL_Texture* tex = SDL_CreateTexture(
renderer,
surf->format->format,
access == Access::STREAMING ? SDL_TEXTUREACCESS_STREAMING : SDL_TEXTUREACCESS_STATIC,
surf->w, surf->h
);
// hacky hint usage
if (access == Access::STREAMING) {
SDL_SetHint("SDL_TextureAccess", "SDL_TEXTUREACCESS_STREAMING");
} else {
SDL_SetHint("SDL_TextureAccess", "SDL_TEXTUREACCESS_STATIC");
}
// TODO: cleanup hints after
SDL_Texture* tex = SDL_CreateTextureFromSurface(renderer, surf);
assert(tex); // TODO: add error reporting
// TODO: error reporting
SDL_UpdateTexture(tex, nullptr, surf->pixels, surf->pitch);
if (filter == NEAREST) {
SDL_SetTextureScaleMode(tex, SDL_SCALEMODE_NEAREST);
@ -52,7 +51,7 @@ bool SDLRendererTextureUploader::updateRGBA(uint64_t tex_id, const uint8_t* data
int pitch = 0;
if (SDL_LockTexture(texture, nullptr, (void**)&pixels, &pitch) != 0) {
std::cerr << "SDLRTU error: failed locking texture '" << SDL_GetError() << "'\n";
// TODO: error
return false;
}