Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtrhi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Laszlo Agocs
qtrhi
Commits
40d96904
Commit
40d96904
authored
Dec 23, 2018
by
Laszlo Agocs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make unorm vertex attrs normalized with all backends
parent
7d71abd1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
5 deletions
+9
-5
examples/rhi/imguidemo/imgui.frag.qsb
examples/rhi/imguidemo/imgui.frag.qsb
+0
-0
examples/rhi/imguidemo/imgui.vert
examples/rhi/imguidemo/imgui.vert
+1
-1
examples/rhi/imguidemo/imgui.vert.qsb
examples/rhi/imguidemo/imgui.vert.qsb
+0
-0
src/rhi/qrhigles2.cpp
src/rhi/qrhigles2.cpp
+5
-1
src/rhi/qrhimetal.mm
src/rhi/qrhimetal.mm
+3
-3
No files found.
examples/rhi/imguidemo/imgui.frag.qsb
View file @
40d96904
No preview for this file type
examples/rhi/imguidemo/imgui.vert
View file @
40d96904
...
...
@@ -17,6 +17,6 @@ out gl_PerVertex { vec4 gl_Position; };
void
main
()
{
v_texcoord
=
texcoord
;
v_color
=
color
/
vec4
(
255
.
0
)
;
v_color
=
color
;
gl_Position
=
ubuf
.
mvp
*
vec4
(
position
.
xy
,
0
.
0
,
1
.
0
);
}
examples/rhi/imguidemo/imgui.vert.qsb
View file @
40d96904
No preview for this file type
src/rhi/qrhigles2.cpp
View file @
40d96904
...
...
@@ -975,6 +975,7 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
const
int
stride
=
psD
->
m_vertexInputLayout
.
bindings
[
a
.
binding
].
stride
;
int
size
=
1
;
GLenum
type
=
GL_FLOAT
;
bool
normalize
=
false
;
switch
(
a
.
format
)
{
case
QRhiVertexInputLayout
::
Attribute
::
Float4
:
type
=
GL_FLOAT
;
...
...
@@ -994,21 +995,24 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
break
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte4
:
type
=
GL_UNSIGNED_BYTE
;
normalize
=
true
;
size
=
4
;
break
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte2
:
type
=
GL_UNSIGNED_BYTE
;
normalize
=
true
;
size
=
2
;
break
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte
:
type
=
GL_UNSIGNED_BYTE
;
normalize
=
true
;
size
=
1
;
break
;
default:
break
;
}
quint32
ofs
=
a
.
offset
+
cmd
.
args
.
bindVertexBuffer
.
offset
;
f
->
glVertexAttribPointer
(
a
.
location
,
size
,
type
,
GL_FALSE
,
stride
,
f
->
glVertexAttribPointer
(
a
.
location
,
size
,
type
,
normalize
,
stride
,
reinterpret_cast
<
const
GLvoid
*>
(
quintptr
(
ofs
)));
f
->
glEnableVertexAttribArray
(
a
.
location
);
}
...
...
src/rhi/qrhimetal.mm
View file @
40d96904
...
...
@@ -1836,12 +1836,12 @@ static inline MTLVertexFormat toMetalAttributeFormat(QRhiVertexInputLayout::Attr
case
QRhiVertexInputLayout
::
Attribute
::
Float
:
return
MTLVertexFormatFloat
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte4
:
return
MTLVertexFormatUChar4
;
return
MTLVertexFormatUChar4
Normalized
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte2
:
return
MTLVertexFormatUChar2
;
return
MTLVertexFormatUChar2
Normalized
;
case
QRhiVertexInputLayout
::
Attribute
::
UNormByte
:
if
(
@available
(
macOS
10.13
,
iOS
11.0
,
*
))
return
MTLVertexFormatUChar
;
return
MTLVertexFormatUChar
Normalized
;
else
Q_UNREACHABLE
();
default:
...
...
Write
Preview
Markdown
is supported
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