Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile shader on windows (Intel HD Graphics) #1251

Closed
fryeb opened this issue May 13, 2017 · 8 comments
Closed

Failed to compile shader on windows (Intel HD Graphics) #1251

fryeb opened this issue May 13, 2017 · 8 comments

Comments

@fryeb
Copy link
Contributor

fryeb commented May 13, 2017

ps_split_composite does not compile. This causes the basic, scrolling and yuv examples to fail. The blob example continues to work. Perhaps a driver bug?

@kvark
Copy link
Member

kvark commented May 14, 2017

@fryeb could you provide the console output?

@fryeb
Copy link
Contributor Author

fryeb commented May 14, 2017

C:\Users\fryeb\Desktop\webrender\webrender>cargo run --example basic
    Finished dev [unoptimized + debuginfo] target(s) in 0.4 secs
     Running `C:\Users\fryeb\Desktop\webrender\target\debug\examples\basic.exe`
OpenGL version 3.2.0 - Build 20.19.15.4331
Shader resource path: None
Failed to compile shader: "ps_split_composite"
ERROR: 0:22: 'constructor' :  cannot convert parameter 1 from 'float' to 'float'
ERROR: 0:18: 'return' : function return is not matching type:


thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Shader(Compilation("ps_split_composite", "ERROR: 0:22: \'constructor\' :  cannot convert parameter 1 from \'float\' to \'float\'\nERROR: 0:18: \'return\' : function return is not matching type: \n\n"))', src\libcore\result.rs:859
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: process didn't exit successfully: `C:\Users\fryeb\Desktop\webrender\target\debug\examples\basic.exe` (exit code: 101)

@kvark
Copy link
Member

kvark commented May 16, 2017

Thanks @fryeb ! The error is interesting ("cannot convert parameter 1 from 'float' to 'float'")... I can tweak the code a bit to see how we can work around this (seemingly a driver bug?), and we'll attempt to repro it internally.

@kvark
Copy link
Member

kvark commented May 16, 2017

If you can test a potential fix, here is a diff:

diff --git a/webrender/res/ps_split_composite.vs.glsl b/webrender/res/ps_split_composite.vs.glsl
index 20cf9a1..309d2c3 100644
--- a/webrender/res/ps_split_composite.vs.glsl
+++ b/webrender/res/ps_split_composite.vs.glsl
@@ -16,10 +16,12 @@ SplitGeometry fetch_split_geometry(int index) {
     vec4 data1 = texelFetchOffset(sSplitGeometry, uv, 0, ivec2(1, 0));
     vec4 data2 = texelFetchOffset(sSplitGeometry, uv, 0, ivec2(2, 0));
 
-    return SplitGeometry(vec3[4](
-        data0.xyz, vec3(data0.w, data1.xy),
-        vec3(data1.zw, data2.x), data2.yzw
-    ));
+    SplitGeometry geo;
+    geo.points[0] = data0.xyz;
+    geo.points[1] = vec3(data0.w, data1.xy);
+    geo.points[2] = vec3(data1.zw, data2.x);
+    geo.points[3] = data2.yzw;
+    return geo;
 }
 
 vec3 bilerp(vec3 a, vec3 b, vec3 c, vec3 d, float s, float t) {

@fryeb
Copy link
Contributor Author

fryeb commented May 17, 2017

@kvark I have tested your solution and it works with all of the tests on my machine. I have also managed to get the following to work.

SplitGeometry geo;
geo.points = vec3[4](
    data0.xyz, vec3(data0.w, data1.xy),
    vec3(data1.zw, data2.x), data2.yzw
);

return geo;

I think the fact that both versions work, while the current one does not suggests that it is probably a driver bug. Thank you for all your help @kvark .

@kvark
Copy link
Member

kvark commented May 17, 2017

Great, @fryeb , thanks for confirmation!
I've added the issue to https://github.com/servo/webrender/wiki/Driver-issues#1251---returning-with-struct-constructor
Would you mind filing a PR with a fix?

@fryeb
Copy link
Contributor Author

fryeb commented May 17, 2017

@kvark I have submitted a pull request here

bors-servo pushed a commit that referenced this issue May 17, 2017
Workaround for driver bug (Intel HD 4400)

Small workaround for a bug in the Intel GLSL compiler. [link](#1251).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1263)
<!-- Reviewable:end -->
@kvark
Copy link
Member

kvark commented May 17, 2017

Fixed by #1263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants