Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laszlo Agocs
qtrhi
Commits
e5859695
Commit
e5859695
authored
Mar 12, 2019
by
Laszlo Agocs
Browse files
mtl: float tex.upload
parent
d03b322b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rhi/qrhimetal.mm
View file @
e5859695
...
...
@@ -1261,6 +1261,35 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
options:
MTLBlitOptionNone
];
curOfs
+=
aligned
(
fullImageSizeBytes
,
texbufAlign
);
}
else
if
(
!
rawData
.
isEmpty
()
&&
isFloatFormat
(
utexD
->
m_format
))
{
const
QSize
subresSize
=
q
->
sizeForMipLevel
(
level
,
utexD
->
m_pixelSize
);
const
int
subresw
=
subresSize
.
width
();
const
int
subresh
=
subresSize
.
height
();
int
w
,
h
;
if
(
mipDesc
.
sourceSize
().
isEmpty
())
{
w
=
subresw
;
h
=
subresh
;
}
else
{
w
=
mipDesc
.
sourceSize
().
width
();
h
=
mipDesc
.
sourceSize
().
height
();
}
quint32
bpl
=
0
;
textureFormatInfo
(
utexD
->
m_format
,
QSize
(
w
,
h
),
&
bpl
,
nullptr
);
memcpy
(
reinterpret_cast
<
char
*>
(
mp
)
+
curOfs
,
rawData
.
constData
(),
rawData
.
size
());
[
blitEnc
copyFromBuffer
:
utexD
->
d
->
stagingBuf
[
currentFrameSlot
]
sourceOffset:
curOfs
sourceBytesPerRow:
bpl
sourceBytesPerImage:
0
sourceSize:
MTLSizeMake
(
w
,
h
,
1
)
toTexture:
utexD
->
d
->
tex
destinationSlice:
layer
destinationLevel:
level
destinationOrigin:
MTLOriginMake
(
dp
.
x
(),
dp
.
y
(),
0
)
options:
MTLBlitOptionNone
];
curOfs
+=
aligned
(
rawData
.
size
(),
texbufAlign
);
}
else
if
(
!
rawData
.
isEmpty
()
&&
isCompressedFormat
(
utexD
->
m_format
))
{
const
QSize
subresSize
=
q
->
sizeForMipLevel
(
level
,
utexD
->
m_pixelSize
);
const
int
subresw
=
subresSize
.
width
();
...
...
@@ -1299,6 +1328,8 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
options:
MTLBlitOptionNone
];
curOfs
+=
aligned
(
rawData
.
size
(),
texbufAlign
);
}
else
{
qWarning
(
"Invalid texture upload for %p layer=%d mip=%d"
,
utexD
,
layer
,
level
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment