gpu,gpu/internal: move InputDesc back from gioui.org/shader module

It was moved to gioui.org/shader by mistake.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-11 16:11:26 +02:00
parent afaa31eca8
commit d38c78d7ac
7 changed files with 18 additions and 10 deletions
+2 -2
View File
@@ -422,7 +422,7 @@ func newCompute(ctx driver.Device) (*compute, error) {
pipe, err := ctx.NewPipeline(driver.PipelineDesc{ pipe, err := ctx.NewPipeline(driver.PipelineDesc{
VertexShader: copyVert, VertexShader: copyVert,
FragmentShader: copyFrag, FragmentShader: copyFrag,
VertexLayout: []shader.InputDesc{ VertexLayout: []driver.InputDesc{
{Type: shader.DataTypeFloat, Size: 2, Offset: 0}, {Type: shader.DataTypeFloat, Size: 2, Offset: 0},
{Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2}, {Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2},
}, },
@@ -457,7 +457,7 @@ func newCompute(ctx driver.Device) (*compute, error) {
pipe, err = ctx.NewPipeline(driver.PipelineDesc{ pipe, err = ctx.NewPipeline(driver.PipelineDesc{
VertexShader: materialVert, VertexShader: materialVert,
FragmentShader: materialFrag, FragmentShader: materialFrag,
VertexLayout: []shader.InputDesc{ VertexLayout: []driver.InputDesc{
{Type: shader.DataTypeFloat, Size: 2, Offset: 0}, {Type: shader.DataTypeFloat, Size: 2, Offset: 0},
{Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2}, {Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2},
}, },
+1 -1
View File
@@ -580,7 +580,7 @@ func createColorPrograms(b driver.Device, vsSrc shader.Sources, fsSrc [3]shader.
SrcFactor: driver.BlendFactorOne, SrcFactor: driver.BlendFactorOne,
DstFactor: driver.BlendFactorOneMinusSrcAlpha, DstFactor: driver.BlendFactorOneMinusSrcAlpha,
} }
layout := []shader.InputDesc{ layout := []driver.InputDesc{
{Type: shader.DataTypeFloat, Size: 2, Offset: 0}, {Type: shader.DataTypeFloat, Size: 2, Offset: 0},
{Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2}, {Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2},
} }
+1 -1
View File
@@ -77,7 +77,7 @@ func TestInputShader(t *testing.T) {
} }
defer vsh.Release() defer vsh.Release()
defer fsh.Release() defer fsh.Release()
layout := []shader.InputDesc{ layout := []driver.InputDesc{
{ {
Type: shader.DataTypeFloat, Type: shader.DataTypeFloat,
Size: 4, Size: 4,
+1 -1
View File
@@ -274,7 +274,7 @@ func (b *Backend) NewFramebuffer(tex driver.Texture) (driver.Framebuffer, error)
return fbo, nil return fbo, nil
} }
func (b *Backend) newInputLayout(vertexShader shader.Sources, layout []shader.InputDesc) (*d3d11.InputLayout, error) { func (b *Backend) newInputLayout(vertexShader shader.Sources, layout []driver.InputDesc) (*d3d11.InputLayout, error) {
if len(vertexShader.Inputs) != len(layout) { if len(vertexShader.Inputs) != len(layout) {
return nil, fmt.Errorf("NewInputLayout: got %d inputs, expected %d", len(layout), len(vertexShader.Inputs)) return nil, fmt.Errorf("NewInputLayout: got %d inputs, expected %d", len(layout), len(vertexShader.Inputs))
} }
+9 -1
View File
@@ -60,11 +60,19 @@ type Pipeline interface {
type PipelineDesc struct { type PipelineDesc struct {
VertexShader VertexShader VertexShader VertexShader
FragmentShader FragmentShader FragmentShader FragmentShader
VertexLayout []shader.InputDesc VertexLayout []InputDesc
BlendDesc BlendDesc BlendDesc BlendDesc
PixelFormat TextureFormat PixelFormat TextureFormat
} }
// InputDesc describes a vertex attribute as laid out in a Buffer.
type InputDesc struct {
Type shader.DataType
Size int
Offset int
}
type BlendDesc struct { type BlendDesc struct {
Enable bool Enable bool
SrcFactor, DstFactor BlendFactor SrcFactor, DstFactor BlendFactor
+2 -2
View File
@@ -115,7 +115,7 @@ type framebuffer struct {
type pipeline struct { type pipeline struct {
prog *program prog *program
inputs []shader.InputLocation inputs []shader.InputLocation
layout []shader.InputDesc layout []driver.InputDesc
blend driver.BlendDesc blend driver.BlendDesc
} }
@@ -157,7 +157,7 @@ type uniformLocation struct {
type inputLayout struct { type inputLayout struct {
inputs []shader.InputLocation inputs []shader.InputLocation
layout []shader.InputDesc layout []driver.InputDesc
} }
// textureTriple holds the type settings for // textureTriple holds the type settings for
+2 -2
View File
@@ -187,14 +187,14 @@ func newStenciler(ctx driver.Device) *stenciler {
if err != nil { if err != nil {
panic(err) panic(err)
} }
progLayout := []shader.InputDesc{ progLayout := []driver.InputDesc{
{Type: shader.DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).Corner))}, {Type: shader.DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).Corner))},
{Type: shader.DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).MaxY))}, {Type: shader.DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).MaxY))},
{Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).FromX))}, {Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).FromX))},
{Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).CtrlX))}, {Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).CtrlX))},
{Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).ToX))}, {Type: shader.DataTypeFloat, Size: 2, Offset: int(unsafe.Offsetof((*(*vertex)(nil)).ToX))},
} }
iprogLayout := []shader.InputDesc{ iprogLayout := []driver.InputDesc{
{Type: shader.DataTypeFloat, Size: 2, Offset: 0}, {Type: shader.DataTypeFloat, Size: 2, Offset: 0},
{Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2}, {Type: shader.DataTypeFloat, Size: 2, Offset: 4 * 2},
} }