gpu.types.GPUOffscreen crashes Blender #77836

Closed
opened 2020-06-13 17:21:55 +02:00 by Juanfran Matheu · 8 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13587 Core Profile Context 20.4.2 26.20.15029.27017

Blender Version
Broken: version: 2.83 release and 2.90
Worked: 2.82 and some previous 2.83

Short description of error
If using gpu.types.GPUOffscreen with samples parameter, it will crash Blender with error:

GPUFrameBuffer: framebuffer status GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE

See docs: https://docs.blender.org/api/blender2.8/gpu.types.html?highlight=gpuoffscreen#gpu.types.GPUOffScreen

Exact steps for others to reproduce the error

  • Open the .blend in 2.83 release or 2.90 alpha (or copy provided code)
  • Run the script in Blender
  • Move cursor over 3d viewport
  • Blender crashes

FILE
offscreen_crash_blender.blend

CODE (based on an example of the official documentation)

import bgl
import bpy
import gpu
from gpu_extras.presets import draw_texture_2d

WIDTH = 512
HEIGHT = 256
SAMPLES = 4

offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT, samples=SAMPLES)


def draw():
    context = bpy.context
    scene = context.scene

    view_matrix = scene.camera.matrix_world.inverted()

    projection_matrix = scene.camera.calc_matrix_camera(
        context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)

    offscreen.draw_view3d(
        scene,
        context.view_layer,
        context.space_data,
        context.region,
        view_matrix,
        projection_matrix)

    bgl.glDisable(bgl.GL_DEPTH_TEST)
    draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)


bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13587 Core Profile Context 20.4.2 26.20.15029.27017 **Blender Version** Broken: version: 2.83 release and 2.90 Worked: 2.82 and some previous 2.83 **Short description of error** If using gpu.types.GPUOffscreen with **samples** parameter, it will crash Blender with error: ``` GPUFrameBuffer: framebuffer status GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE ``` See docs: https://docs.blender.org/api/blender2.8/gpu.types.html?highlight=gpuoffscreen#gpu.types.GPUOffScreen **Exact steps for others to reproduce the error** - Open the .blend in 2.83 release or 2.90 alpha (or copy provided code) - Run the script in Blender - Move cursor over 3d viewport - Blender crashes **FILE** [offscreen_crash_blender.blend](https://archive.blender.org/developer/F8615802/offscreen_crash_blender.blend) **CODE (based on an example of the official documentation)** ``` import bgl import bpy import gpu from gpu_extras.presets import draw_texture_2d WIDTH = 512 HEIGHT = 256 SAMPLES = 4 offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT, samples=SAMPLES) def draw(): context = bpy.context scene = context.scene view_matrix = scene.camera.matrix_world.inverted() projection_matrix = scene.camera.calc_matrix_camera( context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT) offscreen.draw_view3d( scene, context.view_layer, context.space_data, context.region, view_matrix, projection_matrix) bgl.glDisable(bgl.GL_DEPTH_TEST) draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT) bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL') ```

Added subscriber: @jfmatheu

Added subscriber: @jfmatheu
Juanfran Matheu changed title from gpy.types.GPUOffscreen crashes Blender to gpu.types.GPUOffscreen crashes Blender 2020-06-13 17:23:34 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

The workbench rendering engine assumes the buffer isn't multi-sample.

While I didn't look into it in detail, it seems like support could be added.

Setting SAMPLES to 0 resolves the issue.

The workbench rendering engine assumes the buffer isn't multi-sample. While I didn't look into it in detail, it seems like support could be added. Setting SAMPLES to 0 resolves the issue.

Added subscriber: @fclem

Added subscriber: @fclem

Multisample buffers are not compatible with how we draw things in the DRW manager now.

So I will remove the argument from the python function as well.

Multisample buffers are not compatible with how we draw things in the DRW manager now. So I will remove the argument from the python function as well.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Clément Foucault self-assigned this 2020-07-02 17:47:11 +02:00

Fixed by 35481fde40

Fixed by 35481fde40
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#77836
No description provided.