mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
5f97bdc1d3
commit
6f00221051
@ -67,7 +67,7 @@ func (s *Shader) init(device mtl.Device) error {
|
|||||||
f = "Fragment"
|
f = "Fragment"
|
||||||
)
|
)
|
||||||
|
|
||||||
src := metal.Compile(s.ir, v, f)
|
src := msl.Compile(s.ir, v, f)
|
||||||
lib, err := device.MakeLibrary(src, mtl.CompileOptions{})
|
lib, err := device.MakeLibrary(src, mtl.CompileOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("metal: device.MakeLibrary failed: %v, source: %s", err, src)
|
return fmt.Errorf("metal: device.MakeLibrary failed: %v, source: %s", err, src)
|
||||||
|
@ -46,8 +46,8 @@ func glslFragmentNormalize(str string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func metalNormalize(str string) string {
|
func metalNormalize(str string) string {
|
||||||
if strings.HasPrefix(str, metal.Prelude) {
|
if strings.HasPrefix(str, msl.Prelude) {
|
||||||
str = str[len(metal.Prelude):]
|
str = str[len(msl.Prelude):]
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(str)
|
return strings.TrimSpace(str)
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ func TestCompile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if tc.Metal != nil {
|
if tc.Metal != nil {
|
||||||
m := metal.Compile(s, "Vertex", "Fragment")
|
m := msl.Compile(s, "Vertex", "Fragment")
|
||||||
if got, want := metalNormalize(m), metalNormalize(string(tc.Metal)); got != want {
|
if got, want := metalNormalize(m), metalNormalize(string(tc.Metal)); got != want {
|
||||||
compare(t, "Metal", got, want)
|
compare(t, "Metal", got, want)
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ func TestCompile(t *testing.T) {
|
|||||||
|
|
||||||
// Just check that Compile doesn't cause panic.
|
// Just check that Compile doesn't cause panic.
|
||||||
// TODO: Should the results be tested?
|
// TODO: Should the results be tested?
|
||||||
metal.Compile(s, "Vertex", "Fragmentp")
|
msl.Compile(s, "Vertex", "Fragmentp")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ void F0(in float l0, in float l1, out float l2) {
|
|||||||
l2 = l4;
|
l2 = l4;
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
Metal: metal.Prelude + `
|
Metal: msl.Prelude + `
|
||||||
|
|
||||||
void F0(float l0, float l1, thread float& l2);
|
void F0(float l0, float l1, thread float& l2);
|
||||||
|
|
||||||
@ -879,7 +879,7 @@ void F0(in float l0, in float l1, out float l2) {
|
|||||||
l2 = l5;
|
l2 = l5;
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
Metal: metal.Prelude + `
|
Metal: msl.Prelude + `
|
||||||
|
|
||||||
void F0(float l0, float l1, thread float& l2);
|
void F0(float l0, float l1, thread float& l2);
|
||||||
|
|
||||||
@ -1046,7 +1046,7 @@ void main(void) {
|
|||||||
t.Errorf("%s fragment: got: %s, want: %s", tc.Name, got, want)
|
t.Errorf("%s fragment: got: %s, want: %s", tc.Name, got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m := metal.Compile(&tc.Program, "Vertex", "Fragment")
|
m := msl.Compile(&tc.Program, "Vertex", "Fragment")
|
||||||
if tc.Metal != "" {
|
if tc.Metal != "" {
|
||||||
got := m
|
got := m
|
||||||
want := tc.Metal + "\n"
|
want := tc.Metal + "\n"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package metal
|
package msl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package metal
|
package msl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
Loading…
Reference in New Issue
Block a user