Fix issue #239: compilation of shaders-msl/frag/texture-proj-shadow.frag.
Remove unsupported sampler1DShadow from shaders-msl/frag/texture-proj-shadow.frag. Improve error message response from unsupported depth texture formats. Fix several integer cast warnings in unrelated code. Run ./format_all.sh on unrelated files.
This commit is contained in:
parent
6cda7f120b
commit
77f5812c55
2
main.cpp
2
main.cpp
@ -15,9 +15,9 @@
|
||||
*/
|
||||
|
||||
#include "spirv_cpp.hpp"
|
||||
#include "spirv_glsl.hpp"
|
||||
#include "spirv_hlsl.hpp"
|
||||
#include "spirv_msl.hpp"
|
||||
#include "spirv_glsl.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
29
reference/shaders-msl/frag/texture-proj-shadow.frag
Normal file
29
reference/shaders-msl/frag/texture-proj-shadow.frag
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 vClip2 [[user(locn2)]];
|
||||
float4 vClip4 [[user(locn1)]];
|
||||
float3 vClip3 [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uShadow2D [[texture(0)]], sampler uShadow2DSmplr [[sampler(0)]], texture1d<float> uSampler1D [[texture(1)]], sampler uSampler1DSmplr [[sampler(1)]], texture2d<float> uSampler2D [[texture(2)]], sampler uSampler2DSmplr [[sampler(2)]], texture3d<float> uSampler3D [[texture(3)]], sampler uSampler3DSmplr [[sampler(3)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 _20 = in.vClip4;
|
||||
_20.z = in.vClip4.w;
|
||||
out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, in.vClip4.z);
|
||||
out.FragColor = uSampler1D.sample(uSampler1DSmplr, in.vClip2.x / in.vClip2.y).x;
|
||||
out.FragColor = uSampler2D.sample(uSampler2DSmplr, in.vClip3.xy / in.vClip3.z).x;
|
||||
out.FragColor = uSampler3D.sample(uSampler3DSmplr, in.vClip4.xyz / in.vClip4.w).x;
|
||||
return out;
|
||||
}
|
||||
|
19
shaders-msl/frag/texture-proj-shadow.frag
Normal file
19
shaders-msl/frag/texture-proj-shadow.frag
Normal file
@ -0,0 +1,19 @@
|
||||
#version 450
|
||||
|
||||
layout(binding = 1) uniform sampler2DShadow uShadow2D;
|
||||
layout(binding = 2) uniform sampler1D uSampler1D;
|
||||
layout(binding = 3) uniform sampler2D uSampler2D;
|
||||
layout(binding = 4) uniform sampler3D uSampler3D;
|
||||
|
||||
layout(location = 0) out float FragColor;
|
||||
layout(location = 0) in vec3 vClip3;
|
||||
layout(location = 1) in vec4 vClip4;
|
||||
layout(location = 2) in vec2 vClip2;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = textureProj(uShadow2D, vClip4);
|
||||
FragColor = textureProj(uSampler1D, vClip2).x;
|
||||
FragColor = textureProj(uSampler2D, vClip3).x;
|
||||
FragColor = textureProj(uSampler3D, vClip4).x;
|
||||
}
|
@ -3602,18 +3602,18 @@ void Compiler::make_constant_null(uint32_t id, uint32_t type)
|
||||
vector<uint32_t> elements(constant_type.array.back());
|
||||
for (uint32_t i = 0; i < constant_type.array.back(); i++)
|
||||
elements[i] = parent_id;
|
||||
set<SPIRConstant>(id, type, elements.data(), elements.size());
|
||||
set<SPIRConstant>(id, type, elements.data(), uint32_t(elements.size()));
|
||||
}
|
||||
else if (!constant_type.member_types.empty())
|
||||
{
|
||||
uint32_t member_ids = increase_bound_by(constant_type.member_types.size());
|
||||
uint32_t member_ids = increase_bound_by(uint32_t(constant_type.member_types.size()));
|
||||
vector<uint32_t> elements(constant_type.member_types.size());
|
||||
for (uint32_t i = 0; i < constant_type.member_types.size(); i++)
|
||||
{
|
||||
make_constant_null(member_ids + i, constant_type.member_types[i]);
|
||||
elements[i] = member_ids + i;
|
||||
}
|
||||
set<SPIRConstant>(id, type, elements.data(), elements.size());
|
||||
set<SPIRConstant>(id, type, elements.data(), uint32_t(elements.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1240,9 +1240,9 @@ void CompilerHLSL::emit_fixup()
|
||||
if (options.shader_model <= 30)
|
||||
{
|
||||
statement("gl_Position.x = gl_Position.x - gl_HalfPixel.x * "
|
||||
"gl_Position.w;");
|
||||
"gl_Position.w;");
|
||||
statement("gl_Position.y = gl_Position.y + gl_HalfPixel.y * "
|
||||
"gl_Position.w;");
|
||||
"gl_Position.w;");
|
||||
}
|
||||
|
||||
if (CompilerGLSL::options.vertex.flip_vert_y)
|
||||
|
@ -2517,9 +2517,15 @@ string CompilerMSL::image_type_glsl(const SPIRType &type, uint32_t id)
|
||||
{
|
||||
switch (img_type.dim)
|
||||
{
|
||||
case Dim1D:
|
||||
img_type_name += "depth1d_unsupported_by_metal";
|
||||
break;
|
||||
case Dim2D:
|
||||
img_type_name += (img_type.ms ? "depth2d_ms" : (img_type.arrayed ? "depth2d_array" : "depth2d"));
|
||||
break;
|
||||
case Dim3D:
|
||||
img_type_name += "depth3d_unsupported_by_metal";
|
||||
break;
|
||||
case DimCube:
|
||||
img_type_name += (img_type.arrayed ? "depthcube_array" : "depthcube");
|
||||
break;
|
||||
|
@ -206,14 +206,14 @@ def regression_check(shader, glsl, update, keep):
|
||||
if os.path.exists(reference):
|
||||
if md5_for_file(glsl) != md5_for_file(reference):
|
||||
if update:
|
||||
print('Generated GLSL has changed for {}!'.format(reference))
|
||||
print('Generated source code has changed for {}!'.format(reference))
|
||||
# If we expect changes, update the reference file.
|
||||
if os.path.exists(reference):
|
||||
os.remove(reference)
|
||||
make_reference_dir(reference)
|
||||
shutil.move(glsl, reference)
|
||||
else:
|
||||
print('Generated GLSL in {} does not match reference {}!'.format(glsl, reference))
|
||||
print('Generated source code in {} does not match reference {}!'.format(glsl, reference))
|
||||
with open(glsl, 'r') as f:
|
||||
print('')
|
||||
print('Generated:')
|
||||
@ -229,7 +229,7 @@ def regression_check(shader, glsl, update, keep):
|
||||
else:
|
||||
os.remove(glsl)
|
||||
else:
|
||||
print('Found new shader {}. Placing GLSL in {}'.format(joined_path, reference))
|
||||
print('Found new shader {}. Placing generated source code in {}'.format(joined_path, reference))
|
||||
make_reference_dir(reference)
|
||||
shutil.move(glsl, reference)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user