Path: blob/main/glslc/test/option_dash_fhlsl_offsets.py
1560 views
# Copyright 2017 The Shaderc Authors. All rights reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License");3# you may not use this file except in compliance with the License.4# You may obtain a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS,10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# See the License for the specific language governing permissions and12# limitations under the License.1314import expect15from glslc_test_framework import inside_glslc_testsuite16from placeholder import FileShader171819# A GLSL shader with uniforms without explicit bindings.20GLSL_SHADER = """#version 45021layout(set=0, binding=0)22buffer B { float x; vec3 y; } my_ssbo;23void main() {24my_ssbo.x = 1.0;25}"""262728@inside_glslc_testsuite('OptionFHlslOffsets')29class StandardOffsetsByDefault(expect.ValidAssemblyFileWithSubstr):30"""Tests that standard GLSL packign is used by default."""3132shader = FileShader(GLSL_SHADER, '.vert')33glslc_args = ['-S', shader]34expected_assembly_substr = "OpMemberDecorate %B 1 Offset 16"353637@inside_glslc_testsuite('OptionFHlslOffsets')38class HlslOffsetsWhenRequested(expect.ValidAssemblyFileWithSubstr):39"""Tests that standard GLSL packign is used by default."""4041shader = FileShader(GLSL_SHADER, '.vert')42glslc_args = ['-S', '-fhlsl-offsets', shader]43expected_assembly_substr = "OpMemberDecorate %B 1 Offset 4"444546