mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphicsdriver/metal: Bug fix: Use correct pixel format for the screen
This commit is contained in:
parent
ef91fb739f
commit
3fb9c02e2f
@ -280,6 +280,7 @@ type rpsKey struct {
|
||||
filter driver.Filter
|
||||
address driver.Address
|
||||
compositeMode driver.CompositeMode
|
||||
screen bool
|
||||
}
|
||||
|
||||
type Driver struct {
|
||||
@ -511,6 +512,7 @@ func (d *Driver) Reset() error {
|
||||
}
|
||||
}
|
||||
|
||||
for _, screen := range []bool{false, true} {
|
||||
for _, cm := range []bool{false, true} {
|
||||
for _, a := range []driver.Address{
|
||||
driver.AddressClampToZero,
|
||||
@ -533,7 +535,12 @@ func (d *Driver) Reset() error {
|
||||
VertexFunction: vs,
|
||||
FragmentFunction: fs,
|
||||
}
|
||||
rpld.ColorAttachments[0].PixelFormat = mtl.PixelFormatRGBA8UNorm
|
||||
|
||||
pix := mtl.PixelFormatRGBA8UNorm
|
||||
if screen {
|
||||
pix = d.view.colorPixelFormat()
|
||||
}
|
||||
rpld.ColorAttachments[0].PixelFormat = pix
|
||||
rpld.ColorAttachments[0].BlendingEnabled = true
|
||||
|
||||
src, dst := c.Operations()
|
||||
@ -546,6 +553,7 @@ func (d *Driver) Reset() error {
|
||||
return err
|
||||
}
|
||||
d.rpss[rpsKey{
|
||||
screen: screen,
|
||||
useColorM: cm,
|
||||
filter: f,
|
||||
address: a,
|
||||
@ -555,6 +563,7 @@ func (d *Driver) Reset() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d.cq = d.view.getMTLDevice().MakeCommandQueue()
|
||||
return nil
|
||||
@ -604,6 +613,7 @@ func (d *Driver) Draw(indexLen int, indexOffset int, mode driver.CompositeMode,
|
||||
rce.SetRenderPipelineState(d.screenRPS)
|
||||
} else {
|
||||
rce.SetRenderPipelineState(d.rpss[rpsKey{
|
||||
screen: d.dst.screen,
|
||||
useColorM: colorM != nil,
|
||||
filter: filter,
|
||||
address: address,
|
||||
|
Loading…
Reference in New Issue
Block a user