Check for legal lod id
And avoid passing superfluous has_lod parameter.
This commit is contained in:
Родитель
eab111ed32
Коммит
ec39647d92
|
@ -2417,7 +2417,7 @@ bool CompilerGLSL::check_explicit_lod_allowed(uint32_t lod)
|
||||||
{
|
{
|
||||||
auto &execution = get_entry_point();
|
auto &execution = get_entry_point();
|
||||||
bool allowed = !is_legacy_es() || execution.model == ExecutionModelFragment;
|
bool allowed = !is_legacy_es() || execution.model == ExecutionModelFragment;
|
||||||
if (!allowed)
|
if (!allowed && lod != 0)
|
||||||
{
|
{
|
||||||
auto *lod_constant = maybe_get<SPIRConstant>(lod);
|
auto *lod_constant = maybe_get<SPIRConstant>(lod);
|
||||||
if (!lod_constant || lod_constant->scalar_f32() != 0.0f)
|
if (!lod_constant || lod_constant->scalar_f32() != 0.0f)
|
||||||
|
@ -2809,7 +2809,7 @@ void CompilerGLSL::emit_texture_op(const Instruction &i)
|
||||||
string expr;
|
string expr;
|
||||||
bool forward = false;
|
bool forward = false;
|
||||||
expr += to_function_name(img, imgtype, !!fetch, !!gather, !!proj, !!coffsets, (!!coffset || !!offset),
|
expr += to_function_name(img, imgtype, !!fetch, !!gather, !!proj, !!coffsets, (!!coffset || !!offset),
|
||||||
(!!grad_x || !!grad_y), !!lod, !!dref, lod);
|
(!!grad_x || !!grad_y), !!dref, lod);
|
||||||
expr += "(";
|
expr += "(";
|
||||||
expr += to_function_args(img, imgtype, fetch, gather, proj, coord, coord_components, dref, grad_x, grad_y, lod,
|
expr += to_function_args(img, imgtype, fetch, gather, proj, coord, coord_components, dref, grad_x, grad_y, lod,
|
||||||
coffset, offset, bias, comp, sample, &forward);
|
coffset, offset, bias, comp, sample, &forward);
|
||||||
|
@ -2821,7 +2821,7 @@ void CompilerGLSL::emit_texture_op(const Instruction &i)
|
||||||
// Returns the function name for a texture sampling function for the specified image and sampling characteristics.
|
// Returns the function name for a texture sampling function for the specified image and sampling characteristics.
|
||||||
// For some subclasses, the function is a method on the specified image.
|
// For some subclasses, the function is a method on the specified image.
|
||||||
string CompilerGLSL::to_function_name(uint32_t, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
string CompilerGLSL::to_function_name(uint32_t, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
||||||
bool has_array_offsets, bool has_offset, bool has_grad, bool has_lod, bool, uint32_t lod)
|
bool has_array_offsets, bool has_offset, bool has_grad, bool, uint32_t lod)
|
||||||
{
|
{
|
||||||
string fname;
|
string fname;
|
||||||
|
|
||||||
|
@ -2839,7 +2839,7 @@ string CompilerGLSL::to_function_name(uint32_t, const SPIRType &imgtype, bool is
|
||||||
fname += "Proj";
|
fname += "Proj";
|
||||||
if (has_grad)
|
if (has_grad)
|
||||||
fname += "Grad";
|
fname += "Grad";
|
||||||
if (has_lod)
|
if (!!lod)
|
||||||
fname += "Lod";
|
fname += "Lod";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ protected:
|
||||||
virtual std::string to_func_call_arg(uint32_t id);
|
virtual std::string to_func_call_arg(uint32_t id);
|
||||||
virtual std::string to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather,
|
virtual std::string to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather,
|
||||||
bool is_proj, bool has_array_offsets, bool has_offset, bool has_grad,
|
bool is_proj, bool has_array_offsets, bool has_offset, bool has_grad,
|
||||||
bool has_lod, bool has_dref, uint32_t lod);
|
bool has_dref, uint32_t lod);
|
||||||
virtual std::string to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather,
|
virtual std::string to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather,
|
||||||
bool is_proj, uint32_t coord, uint32_t coord_components, uint32_t dref,
|
bool is_proj, uint32_t coord, uint32_t coord_components, uint32_t dref,
|
||||||
uint32_t grad_x, uint32_t grad_y, uint32_t lod, uint32_t coffset,
|
uint32_t grad_x, uint32_t grad_y, uint32_t lod, uint32_t coffset,
|
||||||
|
|
|
@ -989,7 +989,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, uint64_t)
|
||||||
|
|
||||||
// Returns the texture sampling function string for the specified image and sampling characteristics.
|
// Returns the texture sampling function string for the specified image and sampling characteristics.
|
||||||
string CompilerMSL::to_function_name(uint32_t img, const SPIRType &, bool is_fetch, bool is_gather, bool, bool, bool,
|
string CompilerMSL::to_function_name(uint32_t img, const SPIRType &, bool is_fetch, bool is_gather, bool, bool, bool,
|
||||||
bool, bool, bool has_dref, uint32_t)
|
bool, bool has_dref, uint32_t)
|
||||||
{
|
{
|
||||||
// Texture reference
|
// Texture reference
|
||||||
string fname = to_expression(img) + ".";
|
string fname = to_expression(img) + ".";
|
||||||
|
|
|
@ -139,8 +139,8 @@ protected:
|
||||||
std::string to_func_call_arg(uint32_t id) override;
|
std::string to_func_call_arg(uint32_t id) override;
|
||||||
std::string to_name(uint32_t id, bool allow_alias = true) const override;
|
std::string to_name(uint32_t id, bool allow_alias = true) const override;
|
||||||
std::string to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
std::string to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
||||||
bool has_array_offsets, bool has_offset, bool has_grad, bool has_lod,
|
bool has_array_offsets, bool has_offset, bool has_grad, bool has_dref,
|
||||||
bool has_dref, uint32_t lod) override;
|
uint32_t lod) override;
|
||||||
std::string to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
std::string to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
||||||
uint32_t coord, uint32_t coord_components, uint32_t dref, uint32_t grad_x,
|
uint32_t coord, uint32_t coord_components, uint32_t dref, uint32_t grad_x,
|
||||||
uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,
|
uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче