Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/glslc/test/option_dash_fhlsl_offsets.py
1560 views
1
# Copyright 2017 The Shaderc Authors. All rights reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
# http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
15
import expect
16
from glslc_test_framework import inside_glslc_testsuite
17
from placeholder import FileShader
18
19
20
# A GLSL shader with uniforms without explicit bindings.
21
GLSL_SHADER = """#version 450
22
layout(set=0, binding=0)
23
buffer B { float x; vec3 y; } my_ssbo;
24
void main() {
25
my_ssbo.x = 1.0;
26
}"""
27
28
29
@inside_glslc_testsuite('OptionFHlslOffsets')
30
class StandardOffsetsByDefault(expect.ValidAssemblyFileWithSubstr):
31
"""Tests that standard GLSL packign is used by default."""
32
33
shader = FileShader(GLSL_SHADER, '.vert')
34
glslc_args = ['-S', shader]
35
expected_assembly_substr = "OpMemberDecorate %B 1 Offset 16"
36
37
38
@inside_glslc_testsuite('OptionFHlslOffsets')
39
class HlslOffsetsWhenRequested(expect.ValidAssemblyFileWithSubstr):
40
"""Tests that standard GLSL packign is used by default."""
41
42
shader = FileShader(GLSL_SHADER, '.vert')
43
glslc_args = ['-S', '-fhlsl-offsets', shader]
44
expected_assembly_substr = "OpMemberDecorate %B 1 Offset 4"
45
46