mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix #158269: Inconsistency between framebuffer default size and size
Due to an inconsistency in MTLFramebuffer `default_size` and its current `size` could show an incorrect error message when reading from the framebuffer using Python. This has been fixed by making sure by disconnecting the default size in Metal and base class. Sizes are set when needed. There is still inconsistency when running in background. Pull Request: https://projects.blender.org/blender/blender/pulls/158586
This commit is contained in:
parent
bf75de4780
commit
1567225fd1
4 changed files with 74 additions and 52 deletions
|
|
@ -21,6 +21,23 @@ class TestGpuInit(unittest.TestCase):
|
|||
gpu.types.GPUTexture(size=(1024, 1024), format="RGBA8")
|
||||
|
||||
|
||||
class TestGpuFrameBuffer(unittest.TestCase):
|
||||
def test_read_color_bounds_check(self):
|
||||
gpu.init()
|
||||
|
||||
# Setup a framebuffer.
|
||||
tex = gpu.types.GPUTexture(size=(16, 16), format="RGBA8")
|
||||
fb = gpu.types.GPUFrameBuffer(color_slots=[tex])
|
||||
|
||||
with fb.bind():
|
||||
# Reading within bounds should succeed.
|
||||
buf = fb.read_color(0, 0, 1, 1, 4, 0, "UBYTE")
|
||||
|
||||
# Reading outside bounds should raise ValueError.
|
||||
with self.assertRaises(ValueError):
|
||||
fb.read_color(-1, 0, 1, 1, 4, 0, "UBYTE")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue