Use fetch_contant_word3 for exponent bias
Previously was using word4 which is LOD bias, fixes many graphic issues with Vulkan backend
This commit is contained in:
@@ -1477,9 +1477,23 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
|
|||||||
spv::Id is_any_unsigned = builder_->createUnaryOp(
|
spv::Id is_any_unsigned = builder_->createUnaryOp(
|
||||||
spv::OpLogicalNot, type_bool_, is_all_signed);
|
spv::OpLogicalNot, type_bool_, is_all_signed);
|
||||||
|
|
||||||
|
// Load the fetch constant word 3, needed for result exponent biasing.
|
||||||
|
// exp_adjust is in word 3, bits 13:18 (6-bit signed).
|
||||||
|
id_vector_temp_.clear();
|
||||||
|
id_vector_temp_.push_back(const_int_0_);
|
||||||
|
id_vector_temp_.push_back(builder_->makeIntConstant(
|
||||||
|
int((fetch_constant_word_0_index + 3) >> 2)));
|
||||||
|
id_vector_temp_.push_back(builder_->makeIntConstant(
|
||||||
|
int((fetch_constant_word_0_index + 3) & 3)));
|
||||||
|
spv::Id fetch_constant_word_3_signed = builder_->createUnaryOp(
|
||||||
|
spv::OpBitcast, type_int_,
|
||||||
|
builder_->createLoad(builder_->createAccessChain(
|
||||||
|
spv::StorageClassUniform,
|
||||||
|
uniform_fetch_constants_, id_vector_temp_),
|
||||||
|
spv::NoPrecision));
|
||||||
|
|
||||||
// Load the fetch constant word 4, needed unconditionally for LOD
|
// Load the fetch constant word 4, needed unconditionally for LOD
|
||||||
// biasing, for result exponent biasing, and conditionally for stacked
|
// biasing, and conditionally for stacked texture filtering.
|
||||||
// texture filtering.
|
|
||||||
id_vector_temp_.clear();
|
id_vector_temp_.clear();
|
||||||
id_vector_temp_.push_back(const_int_0_);
|
id_vector_temp_.push_back(const_int_0_);
|
||||||
id_vector_temp_.push_back(builder_->makeIntConstant(
|
id_vector_temp_.push_back(builder_->makeIntConstant(
|
||||||
@@ -2198,12 +2212,12 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply the exponent bias from the bits 13:18 of the fetch constant
|
// Apply the exponent bias from the bits 13:18 of the fetch constant
|
||||||
// word 4.
|
// word 3.
|
||||||
spv::Id result_exponent_bias = builder_->createBinBuiltinCall(
|
spv::Id result_exponent_bias = builder_->createBinBuiltinCall(
|
||||||
type_float_, ext_inst_glsl_std_450_, GLSLstd450Ldexp,
|
type_float_, ext_inst_glsl_std_450_, GLSLstd450Ldexp,
|
||||||
const_float_1_,
|
const_float_1_,
|
||||||
builder_->createTriOp(spv::OpBitFieldSExtract, type_int_,
|
builder_->createTriOp(spv::OpBitFieldSExtract, type_int_,
|
||||||
fetch_constant_word_4_signed,
|
fetch_constant_word_3_signed,
|
||||||
builder_->makeUintConstant(13),
|
builder_->makeUintConstant(13),
|
||||||
builder_->makeUintConstant(6)));
|
builder_->makeUintConstant(6)));
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user