~eliasnaur/gio-cpu

2b893722ba32ce46bdba69bd820417fa69336731 — Elias Naur 2 years ago 9046d97
cmd/compile: remove GLSL hash from output

Hashes are no longer needed for ensuring version compatibility.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 2 insertions(+), 8 deletions(-)

M cmd/compile/main.go
M cmd/compile/main.go => cmd/compile/main.go +2 -8
@@ 4,8 4,6 @@ package main

import (
	"bytes"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"flag"
	"fmt"


@@ 109,11 107,9 @@ func main() {
	name := filepath.Base(file)
	name = name[:len(name)-len(filepath.Ext(name))]

	sum := sha256.Sum256(glsl)
	hexSum := hex.EncodeToString(sum[:])
	header := generateHeader(name, layout)
	impl := generateImpl(name, prog)
	goImpl := generateGo(pkg, name, hexSum, layout)
	goImpl := generateGo(pkg, name, layout)
	goFallbackImpl := generateGoFallback(pkg, name, layout)

	syso := fmt.Sprintf("%s_linux_%s.syso", name, *arch)


@@ 259,7 255,6 @@ func generateGoFallback(pkg, name string, layout []descriptor) []byte {

	b.printf("var %sProgramInfo *cpu.ProgramInfo\n\n", strings.Title(name))
	b.printf("type %sDescriptorSetLayout struct{}\n\n", strings.Title(name))
	b.printf("const %sHash = \"\"\n\n", strings.Title(name))
	for _, desc := range layout {
		var _type string
		switch desc._type {


@@ 283,7 278,7 @@ func generateGoFallback(pkg, name string, layout []descriptor) []byte {
	return src
}

func generateGo(pkg, name, hexSum string, layout []descriptor) []byte {
func generateGo(pkg, name string, layout []descriptor) []byte {
	var b printer
	b.printf("// Code generated by gioui.org/cpu/cmd/compile DO NOT EDIT.\n\n")
	b.printf("//go:build %s\n", supportConstraints)


@@ 305,7 300,6 @@ func generateGo(pkg, name, hexSum string, layout []descriptor) []byte {

	b.printf("var %sProgramInfo = (*cpu.ProgramInfo)(unsafe.Pointer(&C.%s_program_info))\n\n", strings.Title(name), name)
	b.printf("type %sDescriptorSetLayout = C.struct_%s_descriptor_set_layout\n\n", strings.Title(name), name)
	b.printf("const %sHash = %q\n\n", strings.Title(name), hexSum)
	for _, desc := range layout {
		var _type string
		switch desc._type {