Closed heyx3 closed 9 months ago
The question of what happens if you make an Image View handle resident twice with different access modes does not seem to be answered anywhere on the internet. So I'm going to simply forbid activating a texture twice.
I'm also going to provide a default access mode of read_write
if one isn't given. This way of doing things is convenient, and not a big deal if it's too permissive (again, as far as I can tell...).
I made some big mistakes when setting these up.
Access Mode
First, the access mode (read, write, or read_write) is not a property of the view itself, but of the view's activation. When activating a view, we need to specify its access mode. When constructing a view, we do not specify an access mode.
On the surface, that's a simple fix: remove "access mode" from the View constructor's parameters, and add it to
view_activate()
's parameters. However, in practice there are some difficult architectural and OpenGL questions. Such as:Format
Meanwhile, something else is missing from image views on construction: a "format". This is how the image appears to the shader, and the only requirement is that the byte size of the apparent pixel format matches the byte size of the true pixel format. For example, you could have an
RG16_UINT
texture show up asR32_FLOAT
in the shader and it work as you'd expect (though different GPU's may have different endianness).