Setting Masking->Stencil Mask->Stencil Image crashes Blender. Includes fix #95981

Closed
opened 2022-02-23 06:44:01 +01:00 by Jeff Dierstein · 13 comments

System Information
Operating system: Linux-5.4.0-100-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.103.01

Blender Version
Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-02-23 01:31, hash: c6df7266c7
Worked: 3.0.1 (Think the issue started sometime in the 3.1.0 Alpha cycle)

Caused by 9d3f35a0bf look at that :)

Short description of error
Setting Stencil Mask->Stencil Image either by creating a new image or selecting an existing image will immediate crash Blender.
Bug affects both linux and windows and is 100% reproducible on my system.

Exact steps for others to reproduce the error
mask_tool_crash_02.blend

  1. Load the attached .blend file (Optional:switch to the mask tool)

  2. In the 3D view, scroll the tool tab down to Masking->Stencil Mask->Stencil Image

  3. Click the 'New' button then click 'Ok' to accept the defaults

  4. crash straight to the desktop

I've also attached the error message that you'll receive after the crash if you start blender via a terminal or cmd prompt.

stencil_masking_error_01.txt

It explains the problem: the smoothstep function is now interpreting "0" as an integer, rather than assuming it's a float.

The Fix

Edit: blender-git/blender/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl

simply change line 18 from:
float mask_step = smoothstep(0, 3.0, mask.r + mask.g + mask.b);
to:
float mask_step = smoothstep(0.0, 3.0, mask.r + mask.g + mask.b);

I've tested this by locally compiling a version of Blender with this change and it creates a binary that works as expected and does not crash when setting the stencil mask.

**System Information** Operating system: Linux-5.4.0-100-generic-x86_64-with-glibc2.31 64 Bits Graphics card: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.103.01 **Blender Version** Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-02-23 01:31, hash: `c6df7266c7` Worked: 3.0.1 (Think the issue started sometime in the 3.1.0 Alpha cycle) Caused by 9d3f35a0bf look at that :) **Short description of error** Setting Stencil Mask->Stencil Image either by creating a new image or selecting an existing image will immediate crash Blender. Bug affects both linux and windows and is 100% reproducible on my system. **Exact steps for others to reproduce the error** [mask_tool_crash_02.blend](https://archive.blender.org/developer/F12883687/mask_tool_crash_02.blend) 1) Load the attached .blend file (Optional:switch to the mask tool) 2) In the 3D view, scroll the tool tab down to Masking->Stencil Mask->Stencil Image 3) Click the 'New' button then click 'Ok' to accept the defaults 4) crash straight to the desktop I've also attached the error message that you'll receive after the crash if you start blender via a terminal or cmd prompt. [stencil_masking_error_01.txt](https://archive.blender.org/developer/F12883686/stencil_masking_error_01.txt) It explains the problem: the smoothstep function is now interpreting "0" as an integer, rather than assuming it's a float. **The Fix** Edit: blender-git/blender/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl simply change line 18 from: float mask_step = smoothstep(0, 3.0, mask.r + mask.g + mask.b); to: float mask_step = smoothstep(0.0, 3.0, mask.r + mask.g + mask.b); I've tested this by locally compiling a version of Blender with this change and it creates a binary that works as expected and does not crash when setting the stencil mask.
Author

Added subscriber: @elkmug

Added subscriber: @elkmug
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Doesn't crash on latest master 165b030b19
Perhaps crash is specific for NVIDIA GPU?

Operating system : Windows-10-10.0.18362-SP0 64 Bits
Graphics card : AMD Radeon(TM) 535 ATI Technologies .
Graphics card: Intel(R) UHD Graphics 620 Intel 4.5.0 - Build 26.20.100.7323```
Doesn't crash on latest master 165b030b19718694eaf33d6602034ed88fdd31a1 Perhaps crash is specific for NVIDIA GPU? ```System Information Operating system : Windows-10-10.0.18362-SP0 64 Bits Graphics card : AMD Radeon(TM) 535 ATI Technologies . Graphics card: Intel(R) UHD Graphics 620 Intel 4.5.0 - Build 26.20.100.7323```
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

Can confirm. Will check.

Can confirm. Will check.
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Even if the implicit conversion is guaranteed by the specification, this seems like an easy fix.
@elkmug If you are interested in submitting your fix as patch, check https://wiki.blender.org/wiki/Process/Contributing_Code.

Even if the implicit conversion is guaranteed by the specification, this seems like an easy fix. @elkmug If you are interested in submitting your fix as patch, check https://wiki.blender.org/wiki/Process/Contributing_Code.
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

Caused by 9d3f35a0bf look at that :)

CC @Jeroen-Bakker

Caused by 9d3f35a0bf look at that :) CC @Jeroen-Bakker
Jeroen Bakker self-assigned this 2022-02-28 08:20:40 +01:00
Member

Not able to reproduce, but it is known that some drivers don't handle implicit conversions that well. Will apply the fix. Thanks!
Interesting that this was already there for 2 years...

Not able to reproduce, but it is known that some drivers don't handle implicit conversions that well. Will apply the fix. Thanks! Interesting that this was already there for 2 years...

This issue was referenced by 2a644deaa7

This issue was referenced by 2a644deaa7b2a94c3c6b73c5fdac59b524337c80
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 3.1 milestone 2023-02-08 15:52:45 +01:00
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
6 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#95981
No description provided.