Difference between GLSL and BI render when Value node is connected to the Output node #44755

Closed
opened 2015-05-18 17:52:47 +02:00 by Alexander Romanov · 14 comments

Steps to reproduce the bug:

  1. Enable Material mode.
  2. Create node material.
  3. Connect Value node to the Output node.

It looks like regression after adding optimizations for set_value and set_rgb functions in gpu_codegen.c:

if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) 
Steps to reproduce the bug: 1) Enable Material mode. 2) Create node material. 3) Connect Value node to the Output node. It looks like regression after adding optimizations for set_value and set_rgb functions in gpu_codegen.c: ``` if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Bastien Montagne was assigned by Alexander Romanov 2015-05-18 17:52:47 +02:00
Author
Member

Added subscriber: @AlexanderRomanov

Added subscriber: @AlexanderRomanov
Bastien Montagne removed their assignment 2015-05-18 18:03:42 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

Please do not make wild assignments that way, especially when you do not know what you are doing.

Please do not make wild assignments that way, especially when you do not know what you are doing.

Added subscriber: @Psy-Fi

Added subscriber: @Psy-Fi
Antonis Ryakiotakis self-assigned this 2015-05-18 19:32:03 +02:00

Let me take a look

Let me take a look

Added subscriber: @Sergey

Added subscriber: @Sergey

Added subscriber: @brecht

Added subscriber: @brecht

So, bug exists since a long time. I am not sure exactly what purpose the duplication under those streq in the code is meant to serve, but removing those checks works by accident. Basically, the set_* function output variables get expanded/converted to the right types in codegen_convert_datatype, which is called if the input is of type GPU_SOURCE_TEX_PIXEL. I need to study the code further here to see what is happening, but expanding such variables should be doable in general.

@brecht I would really value your input on why these exceptions exist in the code, I have been wondering for a long time - also we have a few other set functions that might need similar treatment?

So, bug exists since a long time. I am not sure exactly what purpose the duplication under those streq in the code is meant to serve, but removing those checks works by accident. Basically, the set_* function output variables get expanded/converted to the right types in codegen_convert_datatype, which is called if the input is of type GPU_SOURCE_TEX_PIXEL. I need to study the code further here to see what is happening, but expanding such variables should be doable in general. @brecht I would really value your input on why these exceptions exist in the code, I have been wondering for a long time - also we have a few other set functions that might need similar treatment?

I don't remember this well. From looking at 178be13f65 which added this code, my guess is it's an optimization to leave out unnecessary set_value and set_rgb from the generated code, to make it smaller. I'm not sure that's actually important though and perhaps the simple correct fix is to just leave it out so that the datatype conversion code is used.

There's another similar test in GPU_link_changed which is important to keep, it skips generating code when e.g. diffuse reflectivity has a fixed value of 0.

I don't remember this well. From looking at 178be13f65 which added this code, my guess is it's an optimization to leave out unnecessary `set_value` and `set_rgb` from the generated code, to make it smaller. I'm not sure that's actually important though and perhaps the simple correct fix is to just leave it out so that the datatype conversion code is used. There's another similar test in `GPU_link_changed` which is important to keep, it skips generating code when e.g. diffuse reflectivity has a fixed value of 0.

Hi @brecht, thanks for the heads up!

I studied the code in more detail. Looks like what the optimization does is take the set_value node input link directly (since it's just copying stuff around anyway). The node itself is pruned later. I don't think it's a bad idea generally, so I'll probably just use codegen_convert_datatype to uniforms as well instead. Fingers crossed it works as expected...

Hi @brecht, thanks for the heads up! I studied the code in more detail. Looks like what the optimization does is take the set_value node input link directly (since it's just copying stuff around anyway). The node itself is pruned later. I don't think it's a bad idea generally, so I'll probably just use codegen_convert_datatype to uniforms as well instead. Fingers crossed it works as expected...

This issue was referenced by 78411dc7d7

This issue was referenced by 78411dc7d77328e6c8fb7b38f7cacd186e68171e

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Kept the optimization when input-output types match, it should be fine now, thanks for the report!

Kept the optimization when input-output types match, it should be fine now, thanks for the report!
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#44755
No description provided.