Title: [237022] trunk/Tools
- Revision
- 237022
- Author
- [email protected]
- Date
- 2018-10-10 18:09:55 -0700 (Wed, 10 Oct 2018)
Log Message
[WHSL -> MSL] Annotate semantics correctly in generated MSL
https://bugs.webkit.org/show_bug.cgi?id=190452
<rdar://problem/45178272>
Reviewed by Myles Maxfield.
Correctly label the appropriate semantics as [[position]]
and [[color(N)]].
* WebGPUShadingLanguageRI/Metal/MSLBackend.js: Identify position
and color attributes. Also use the semantic's index rather than
a counter.
* WebGPUShadingLanguageRI/Metal/WhlslToMsl.html: Use a <pre> for
output, and only include the actual shader code.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (237021 => 237022)
--- trunk/Tools/ChangeLog 2018-10-11 00:47:28 UTC (rev 237021)
+++ trunk/Tools/ChangeLog 2018-10-11 01:09:55 UTC (rev 237022)
@@ -1,3 +1,20 @@
+2018-10-10 Dean Jackson <[email protected]>
+
+ [WHSL -> MSL] Annotate semantics correctly in generated MSL
+ https://bugs.webkit.org/show_bug.cgi?id=190452
+ <rdar://problem/45178272>
+
+ Reviewed by Myles Maxfield.
+
+ Correctly label the appropriate semantics as [[position]]
+ and [[color(N)]].
+
+ * WebGPUShadingLanguageRI/Metal/MSLBackend.js: Identify position
+ and color attributes. Also use the semantic's index rather than
+ a counter.
+ * WebGPUShadingLanguageRI/Metal/WhlslToMsl.html: Use a <pre> for
+ output, and only include the actual shader code.
+
2018-10-10 Ross Kirsling <[email protected]>
build-webkit --inspector-frontend shouldn't have a nonzero exit code
Modified: trunk/Tools/WebGPUShadingLanguageRI/Metal/MSLBackend.js (237021 => 237022)
--- trunk/Tools/WebGPUShadingLanguageRI/Metal/MSLBackend.js 2018-10-11 00:47:28 UTC (rev 237021)
+++ trunk/Tools/WebGPUShadingLanguageRI/Metal/MSLBackend.js 2018-10-11 01:09:55 UTC (rev 237022)
@@ -325,7 +325,6 @@
const structTypeAttributes = this._allTypeAttributes.attributesForType(structType);
let src = "" ${this._typeUnifier.uniqueTypeId(structType)} {\n`;
- let index = 0;
for (let [fieldName, field] of structType.fieldMap) {
const mangledFieldName = structTypeAttributes.mangledFieldName(fieldName);
src += ` ${this._typeUnifier.uniqueTypeId(field.type)} ${mangledFieldName}`;
@@ -332,11 +331,11 @@
const annotations = [];
if (structTypeAttributes.isVertexAttribute)
- annotations.push(`attribute(${index++})`);
- if (structTypeAttributes.isVertexOutputOrFragmentInput && fieldName === "wsl_Position")
+ annotations.push(`attribute(${field._semantic._index})`);
+ if (structTypeAttributes.isVertexOutputOrFragmentInput && field._semantic._name === "SV_Position")
annotations.push("position");
- if (structTypeAttributes.isFragmentOutput && fieldName === "wsl_Color")
- annotations.push("color(0)");
+ if (structTypeAttributes.isFragmentOutput && field._semantic._name == "SV_Target")
+ annotations.push(`color(${field._semantic._extraArguments[0]})`);
if (annotations.length)
src += ` [[${annotations.join(", ")}]]`;
src += `; // ${fieldName} (${field.type}) \n`;
Modified: trunk/Tools/WebGPUShadingLanguageRI/Metal/WhlslToMsl.html (237021 => 237022)
--- trunk/Tools/WebGPUShadingLanguageRI/Metal/WhlslToMsl.html 2018-10-11 00:47:28 UTC (rev 237021)
+++ trunk/Tools/WebGPUShadingLanguageRI/Metal/WhlslToMsl.html 2018-10-11 01:09:55 UTC (rev 237022)
@@ -240,7 +240,11 @@
let output = document.querySelector("#output");
output.textContent = "Compiling...";
let result = whlslToMsl(source);
- output.textContent = JSON.stringify(result);
+ if (!result._error) {
+ output.textContent = result._metalShaderLanguageSource;
+ } else {
+ output.textContent = `Error: ${result._error.originString}\n${result._error.syntaxErrorMessage}`;
+ }
}
window.addEventListener("load", init, false);
@@ -285,9 +289,9 @@
return result;
}
</textarea>
-<div id="output">
+<pre id="output">
No compiled output.
-</div>
+</pre>
<div id="controls">
<button>Compile</button>
</div>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes