Fix macos build error
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
@@ -441,7 +441,7 @@ void KRPipeline::initPushConstantStage(ShaderStage stage, const SpvReflectShader
|
|||||||
for (int iUniform = 0; iUniform < kPushConstantCount; iUniform++) {
|
for (int iUniform = 0; iUniform < kPushConstantCount; iUniform++) {
|
||||||
for (int iMember = 0; iMember < block.member_count; iMember++) {
|
for (int iMember = 0; iMember < block.member_count; iMember++) {
|
||||||
const SpvReflectBlockVariable& member = block.members[iMember];
|
const SpvReflectBlockVariable& member = block.members[iMember];
|
||||||
if (stricmp(SHADER_VALUE_NAMES[iUniform], member.name) == 0) {
|
if (IsShaderValueName(iUniform, member.name)) {
|
||||||
pushConstants.offset[iUniform] = member.offset;
|
pushConstants.offset[iUniform] = member.offset;
|
||||||
pushConstants.size[iUniform] = member.size;
|
pushConstants.size[iUniform] = member.size;
|
||||||
if (member.type_description->op == SpvOpTypeVector && member.numeric.scalar.width == 32) {
|
if (member.type_description->op == SpvOpTypeVector && member.numeric.scalar.width == 32) {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "KRShaderReflection.h"
|
#include "KRShaderReflection.h"
|
||||||
|
#include "KRContext.h"
|
||||||
|
|
||||||
using namespace hydra;
|
using namespace hydra;
|
||||||
|
|
||||||
@@ -105,6 +106,15 @@ const char* SHADER_VALUE_NAMES[] = {
|
|||||||
"fade_color", // PushConstant::fade_color
|
"fade_color", // PushConstant::fade_color
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool IsShaderValueName(int index, const char* szName)
|
||||||
|
{
|
||||||
|
assert(index >= 0 && index <= (int)ShaderValue::NUM_SHADER_VALUES);
|
||||||
|
if (stricmp(SHADER_VALUE_NAMES[index], szName) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool KRReflectedObject::getShaderValue(ShaderValue value, ShaderValueType type, void* output) const
|
bool KRReflectedObject::getShaderValue(ShaderValue value, ShaderValueType type, void* output) const
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ enum class ShaderValue : uint8_t
|
|||||||
NUM_SHADER_VALUES
|
NUM_SHADER_VALUES
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* SHADER_VALUE_NAMES[];
|
bool IsShaderValueName(int index, const char* szName);
|
||||||
|
|
||||||
class KRReflectedObject
|
class KRReflectedObject
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user