OSL console message missing #40293

Closed
opened 2014-05-21 12:14:25 +02:00 by Dominik · 12 comments

System Information
Arch Linux

Blender Version
Blender Version 2.70a
Build hash: f93bc76

Short description of error
Functions printf(), error(), warning() does not give any output in system console and blender internal info.
Even after system update, and blender reinstallation.

Exact steps for others to reproduce the error
Declaration of some variable:

int Test = 5;

then print:

printf("%d", Test);
**System Information** Arch Linux **Blender Version** Blender Version 2.70a Build hash: f93bc76 **Short description of error** Functions printf(), error(), warning() does not give any output in system console and blender internal info. Even after system update, and blender reinstallation. **Exact steps for others to reproduce the error** Declaration of some variable: ``` int Test = 5; ``` then print: ``` printf("%d", Test); ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @grrrl212

Added subscriber: @grrrl212
Thomas Dinges self-assigned this 2014-05-21 15:03:33 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

I can confirm this. Tested with this simple .osl shader. test_print.osl

Tested on Windows x64, vc2008.

I can confirm this. Tested with this simple .osl shader. [test_print.osl](https://archive.blender.org/developer/F91473/test_print.osl) Tested on Windows x64, vc2008.

Added subscriber: @brecht

Added subscriber: @brecht

The problem is that the print statement is getting optimized out. The workaround is to run Blender with the environment variable OSL_OPTIONS="optimize=0".

I'm not sure how to best deal with this, we can either advise user to use this environment variable, or add some option in Blender to enable OSL shader debugging which then sets this and perhaps other options useful for debugging.

The problem is that the print statement is getting optimized out. The workaround is to run Blender with the environment variable `OSL_OPTIONS="optimize=0"`. I'm not sure how to best deal with this, we can either advise user to use this environment variable, or add some option in Blender to enable OSL shader debugging which then sets this and perhaps other options useful for debugging.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Added subscriber: @Sergey

Added subscriber: @Sergey

I don't think it's a bug, just likely shader gets optimized out to a constant. If you set OSL_OPTIONS environment variable to "optimize=0" then you'll totally see the prints.

In fact, the same exact issue has been discussed already there https://github.com/imageworks/OpenShadingLanguage/issues/267

@brecht, correct me if i'm wrong, but it's just specific of how OSL optimizes the shaders. It's done for speed, if you want to debug using printfs, you need to disable optimizations.

I don't think it's a bug, just likely shader gets optimized out to a constant. If you set `OSL_OPTIONS` environment variable to "optimize=0" then you'll totally see the prints. In fact, the same exact issue has been discussed already there https://github.com/imageworks/OpenShadingLanguage/issues/267 @brecht, correct me if i'm wrong, but it's just specific of how OSL optimizes the shaders. It's done for speed, if you want to debug using printfs, you need to disable optimizations.

Added subscriber: @gp

Added subscriber: @gp

I've just tested this in latest blender versions 2.79 and 2.80 on macOS and can confirm the prints don't work, with OSL_OPTIONS environment variable set to "optimize=0".

I've just tested this in latest blender versions 2.79 and 2.80 on macOS and can confirm the prints don't work, with OSL_OPTIONS environment variable set to "optimize=0".

@gp, Works with the demo shader on Linux. Could be something platform specific or specific to your setup.

Please make a new report, giving all the details, including simple .blend file which demonstrates the issue.

@gp, Works with the demo shader on Linux. Could be something platform specific or specific to your setup. Please make a new report, giving all the details, including simple .blend file which demonstrates the issue.
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#40293
No description provided.