本文整理汇总了C++中ResourceId函数的典型用法代码示例。如果您正苦于以下问题:C++ ResourceId函数的具体用法?C++ ResourceId怎么用?C++ ResourceId使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResourceId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImageViewer
ImageViewer(IReplayDriver *proxy, const char *filename)
: m_Proxy(proxy), m_Filename(filename), m_TextureID()
{
if(m_Proxy == NULL)
RDCERR("Unexpectedly NULL proxy at creation of ImageViewer");
m_Props.pipelineType = ePipelineState_D3D11;
m_Props.degraded = false;
m_FrameRecord.frameInfo.fileOffset = 0;
m_FrameRecord.frameInfo.firstEvent = 1;
m_FrameRecord.frameInfo.frameNumber = 1;
m_FrameRecord.frameInfo.immContextId = ResourceId();
RDCEraseEl(m_FrameRecord.frameInfo.stats);
create_array_uninit(m_FrameRecord.drawcallList, 1);
FetchDrawcall &d = m_FrameRecord.drawcallList[0];
d.context = ResourceId();
d.drawcallID = 1;
d.eventID = 1;
d.name = filename;
RefreshFile();
create_array_uninit(m_PipelineState.m_OM.RenderTargets, 1);
m_PipelineState.m_OM.RenderTargets[0].Resource = m_TextureID;
}
示例2: SERIALISE_ELEMENT
bool WrappedOpenGL::Serialise_glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
{
SERIALISE_ELEMENT(uint32_t, First, first);
SERIALISE_ELEMENT(int32_t, Count, count);
GLuint *samps = NULL;
if(m_State <= EXECUTING)
samps = new GLuint[Count];
for(int32_t i = 0; i < Count; i++)
{
SERIALISE_ELEMENT(ResourceId, id,
samplers && samplers[i]
? GetResourceManager()->GetID(SamplerRes(GetCtx(), samplers[i]))
: ResourceId());
if(m_State <= EXECUTING)
{
if(id != ResourceId())
samps[i] = GetResourceManager()->GetLiveResource(id).name;
else
samps[i] = 0;
}
}
if(m_State <= EXECUTING)
{
m_Real.glBindSamplers(First, Count, samps);
delete[] samps;
}
return true;
}
示例3: SoundResource
void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
if (newSound->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, newSound->resourceId)))
newSound->soundRes = new SoundResource(newSound->resourceId, _resMan, _soundVersion);
else
newSound->soundRes = 0;
// In SCI1.1 games, sound effects are started from here. If we can find
// a relevant audio resource, play it, otherwise switch to synthesized
// effects. If the resource exists, play it using map 65535 (sound
// effects map)
bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
// Hoyle 4 has garbled audio resources in place of the sound resources.
// The demo of GK1 has no alternate sound effects.
if ((g_sci->getGameId() == GID_HOYLE4) ||
(g_sci->getGameId() == GID_GK1 && g_sci->isDemo()))
checkAudioResource = false;
if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) {
// Found a relevant audio resource, create an audio stream if there is
// no associated sound resource, or if both resources exist and the
// user wants the digital version.
if (_bMultiMidi || !newSound->soundRes) {
int sampleLen;
newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
newSound->soundType = Audio::Mixer::kSpeechSoundType;
}
}
if (!newSound->pStreamAud && newSound->soundRes)
_music->soundInitSnd(newSound);
}
示例4: _resourceId
GfxFontFromResource::GfxFontFromResource(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId)
: _resourceId(resourceId), _screen(screen), _resMan(resMan) {
assert(resourceId != -1);
// Workaround: lsl1sci mixes its own internal fonts with the global
// SCI ones, so we translate them here, by removing their extra bits
if (!resMan->testResource(ResourceId(kResourceTypeFont, resourceId)))
resourceId = resourceId & 0x7ff;
_resource = resMan->findResource(ResourceId(kResourceTypeFont, resourceId), true);
if (!_resource) {
error("font resource %d not found", resourceId);
}
_resourceData = _resource->data;
_numChars = READ_SCI32ENDIAN_UINT16(_resourceData + 2);
_fontHeight = READ_SCI32ENDIAN_UINT16(_resourceData + 4);
_chars = new Charinfo[_numChars];
// filling info for every char
for (int16 i = 0; i < _numChars; i++) {
_chars[i].offset = READ_SCI32ENDIAN_UINT16(_resourceData + 6 + i * 2);
_chars[i].w = _resourceData[_chars[i].offset];
_chars[i].h = _resourceData[_chars[i].offset + 1];
}
}
示例5: ResourceId
ReplayOutput::ReplayOutput(ReplayRenderer *parent, void *w)
{
m_pRenderer = parent;
m_MainOutput.dirty = true;
m_OverlayDirty = true;
m_pDevice = parent->GetDevice();
m_OverlayResourceId = ResourceId();
RDCEraseEl(m_RenderData);
m_PixelContext.wndHandle = 0;
m_PixelContext.outputID = 0;
m_PixelContext.texture = ResourceId();
m_PixelContext.depthMode = false;
m_ContextX = -1.0f;
m_ContextY = -1.0f;
m_Config.m_Type = eOutputType_None;
if(w) m_MainOutput.outputID = m_pDevice->MakeOutputWindow(w, true);
else m_MainOutput.outputID = 0;
m_MainOutput.texture = ResourceId();
m_pDevice->GetOutputWindowDimensions(m_MainOutput.outputID, m_Width, m_Height);
m_FirstDeferredEvent = 0;
m_LastDeferredEvent = 0;
m_CustomShaderResourceId = ResourceId();
}
示例6: switch
ResourceId ReplayRenderer::BuildCustomShader(const wchar_t *entry, const wchar_t *source, const uint32_t compileFlags, ShaderStageType type, rdctype::wstr *errors)
{
ResourceId id;
string errs;
switch(type)
{
case eShaderStage_Vertex:
case eShaderStage_Hull:
case eShaderStage_Domain:
case eShaderStage_Geometry:
case eShaderStage_Pixel:
case eShaderStage_Compute:
break;
default:
RDCERR("Unexpected type in BuildShader!");
return ResourceId();
}
m_pDevice->BuildCustomShader(narrow(source), narrow(entry), compileFlags, type, &id, &errs);
if(id != ResourceId())
m_CustomShaders.insert(id);
if(errors) *errors = widen(errs);
return id;
}
示例7: SERIALISE_ELEMENT
bool WrappedOpenGL::Serialise_glNamedFramebufferTextureEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
{
SERIALISE_ELEMENT(GLenum, Attach, attachment);
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(GetCtx(), texture)));
SERIALISE_ELEMENT(int32_t, Level, level);
SERIALISE_ELEMENT(ResourceId, fbid, (framebuffer == 0 ? ResourceId() : GetResourceManager()->GetID(FramebufferRes(GetCtx(), framebuffer))));
if(m_State < WRITING)
{
GLResource res = GetResourceManager()->GetLiveResource(id);
if(fbid == ResourceId())
{
glNamedFramebufferTextureEXT(0, Attach, res.name, Level);
}
else
{
GLResource fbres = GetResourceManager()->GetLiveResource(fbid);
glNamedFramebufferTextureEXT(fbres.name, Attach, res.name, Level);
}
if(m_State == READING)
{
m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV;
}
}
return true;
}
示例8: TEST
TEST(ReferenceLinkerTest, LinkMangledReferencesAndAttributes) {
std::unique_ptr<IAaptContext> context = test::ContextBuilder()
.setCompilationPackage(u"com.app.test")
.setPackageId(0x7f)
.setNameManglerPolicy(NameManglerPolicy{ u"com.app.test", { u"com.android.support" } })
.addSymbolSource(test::StaticSymbolSourceBuilder()
.addPublicSymbol(u"@com.app.test:attr/com.android.support$foo",
ResourceId(0x7f010000),
test::AttributeBuilder()
.setTypeMask(ResTable_map::TYPE_COLOR)
.build())
.build())
.build();
std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder()
.setPackageId(u"com.app.test", 0x7f)
.addValue(u"@com.app.test:style/Theme", ResourceId(0x7f020000),
test::StyleBuilder().addItem(u"@com.android.support:attr/foo",
ResourceUtils::tryParseColor(u"#ff0000"))
.build())
.build();
ReferenceLinker linker;
ASSERT_TRUE(linker.consume(context.get(), table.get()));
Style* style = test::getValue<Style>(table.get(), u"@com.app.test:style/Theme");
ASSERT_NE(style, nullptr);
ASSERT_EQ(1u, style->entries.size());
AAPT_ASSERT_TRUE(style->entries.front().key.id);
EXPECT_EQ(style->entries.front().key.id.value(), ResourceId(0x7f010000));
}
示例9: SERIALISE_ELEMENT
bool WrappedOpenGL::Serialise_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
{
SERIALISE_ELEMENT(ResourceId, pipe, GetResourceManager()->GetID(ProgramPipeRes(GetCtx(), pipeline)));
SERIALISE_ELEMENT(uint32_t, Stages, stages);
SERIALISE_ELEMENT(ResourceId, prog, (program ? GetResourceManager()->GetID(ProgramRes(GetCtx(), program)) : ResourceId()));
if(m_State < WRITING)
{
if(prog != ResourceId())
{
ResourceId livePipeId = GetResourceManager()->GetLiveID(pipe);
ResourceId liveProgId = GetResourceManager()->GetLiveID(prog);
PipelineData &pipeDetails = m_Pipelines[livePipeId];
ProgramData &progDetails = m_Programs[liveProgId];
for(size_t s=0; s < 6; s++)
{
if(Stages & ShaderBit(s))
{
for(size_t sh=0; sh < progDetails.shaders.size(); sh++)
{
if(m_Shaders[ progDetails.shaders[sh] ].type == ShaderEnum(s))
{
pipeDetails.stagePrograms[s] = liveProgId;
pipeDetails.stageShaders[s] = progDetails.shaders[sh];
break;
}
}
}
}
m_Real.glUseProgramStages(GetResourceManager()->GetLiveResource(pipe).name,
Stages,
GetResourceManager()->GetLiveResource(prog).name);
}
else
{
ResourceId livePipeId = GetResourceManager()->GetLiveID(pipe);
PipelineData &pipeDetails = m_Pipelines[livePipeId];
for(size_t s=0; s < 6; s++)
{
if(Stages & ShaderBit(s))
{
pipeDetails.stagePrograms[s] = ResourceId();
pipeDetails.stageShaders[s] = ResourceId();
}
}
m_Real.glUseProgramStages(GetResourceManager()->GetLiveResource(pipe).name,
Stages,
0);
}
}
return true;
}
示例10: RDCMAX
uint32_t ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint32_t *pickedInstance)
{
FetchDrawcall *draw = m_pRenderer->GetDrawcallByEID(eventID);
if(!draw)
return ~0U;
if(m_RenderData.meshDisplay.type == eMeshDataStage_Unknown)
return ~0U;
if((draw->flags & eDraw_Drawcall) == 0)
return ~0U;
MeshDisplay cfg = m_RenderData.meshDisplay;
if(cfg.position.buf == ResourceId())
return ~0U;
cfg.position.buf = m_pDevice->GetLiveID(cfg.position.buf);
cfg.position.idxbuf = m_pDevice->GetLiveID(cfg.position.idxbuf);
cfg.second.buf = m_pDevice->GetLiveID(cfg.second.buf);
cfg.second.idxbuf = m_pDevice->GetLiveID(cfg.second.idxbuf);
*pickedInstance = 0;
if(draw->flags & eDraw_Instanced)
{
uint32_t maxInst = 0;
if(m_RenderData.meshDisplay.showPrevInstances)
maxInst = RDCMAX(1U, m_RenderData.meshDisplay.curInstance);
if(m_RenderData.meshDisplay.showAllInstances)
maxInst = RDCMAX(1U, draw->numInstances);
for(uint32_t inst = 0; inst < maxInst; inst++)
{
// get the 'most final' stage
MeshFormat fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_GSOut);
if(fmt.buf == ResourceId())
fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_VSOut);
cfg.position = fmt;
uint32_t ret = m_pDevice->PickVertex(m_EventID, cfg, x, y);
if(ret != ~0U)
{
*pickedInstance = inst;
return ret;
}
}
return ~0U;
}
else
{
return m_pDevice->PickVertex(m_EventID, cfg, x, y);
}
}
示例11: ResourceId
ResourceId ResourceId::getParentResourceId() const {
if (isRelationAccess()) {
return ResourceId(db_id_);
} else if (isBlockAccess()) {
return ResourceId(db_id_, rel_id_);
} else if (isTupleAccess()) {
return ResourceId(db_id_, rel_id_, block_id_);
} else {
LOG(FATAL) << "Database level does not have any parent level.";
}
}
示例12: DescriptorFromPortableHandle
ResourceId D3D12RenderState::GetDSVID() const
{
if(dsv.heap != ResourceId())
{
const D3D12Descriptor *desc = DescriptorFromPortableHandle(GetResourceManager(), dsv);
RDCASSERT(desc->GetType() == D3D12Descriptor::TypeDSV);
return GetResID(desc->nonsamp.resource);
}
return ResourceId();
}
示例13: ResourceId
void ReplayOutput::DisplayContext()
{
if(m_PixelContext.outputID == 0)
return;
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
m_pDevice->BindOutputWindow(m_PixelContext.outputID, false);
if((m_Config.m_Type != eOutputType_TexDisplay) || (m_ContextX < 0.0f && m_ContextY < 0.0f) ||
(m_RenderData.texDisplay.texid == ResourceId()))
{
m_pDevice->RenderCheckerboard(Vec3f(0.666f, 0.666f, 0.666f), Vec3f(0.333f, 0.333f, 0.333f));
m_pDevice->FlipOutputWindow(m_PixelContext.outputID);
return;
}
m_pDevice->ClearOutputWindowColour(m_PixelContext.outputID, color);
TextureDisplay disp = m_RenderData.texDisplay;
disp.rawoutput = false;
disp.CustomShader = ResourceId();
if(m_RenderData.texDisplay.CustomShader != ResourceId())
disp.texid = m_CustomShaderResourceId;
if((m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawDraw ||
m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawPass) &&
m_OverlayResourceId != ResourceId())
disp.texid = m_OverlayResourceId;
disp.scale = 8.0f;
int32_t width = 0, height = 0;
m_pDevice->GetOutputWindowDimensions(m_PixelContext.outputID, width, height);
float w = (float)width;
float h = (float)height;
disp.offx = -m_ContextX * disp.scale;
disp.offy = -m_ContextY * disp.scale;
disp.offx += w / 2.0f;
disp.offy += h / 2.0f;
disp.texid = m_pDevice->GetLiveID(disp.texid);
m_pDevice->RenderTexture(disp);
m_pDevice->RenderHighlightBox(w, h, disp.scale);
m_pDevice->FlipOutputWindow(m_PixelContext.outputID);
}
示例14: RDCEraseEl
bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint32_t y,
uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *ret)
{
if(ret == NULL || tex == ResourceId())
return false;
RDCEraseEl(ret->value_f);
bool decodeRamp = false;
FormatComponentType typeHint = m_RenderData.texDisplay.typeHint;
if(customShader && m_RenderData.texDisplay.CustomShader != ResourceId() &&
m_CustomShaderResourceId != ResourceId())
{
tex = m_CustomShaderResourceId;
typeHint = eCompType_None;
}
if((m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawDraw ||
m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawPass) &&
m_OverlayResourceId != ResourceId())
{
decodeRamp = true;
tex = m_OverlayResourceId;
typeHint = eCompType_None;
}
m_pDevice->PickPixel(m_pDevice->GetLiveID(tex), x, y, sliceFace, mip, sample, typeHint,
ret->value_f);
if(decodeRamp)
{
for(size_t c = 0; c < ARRAY_COUNT(overdrawRamp); c++)
{
if(fabs(ret->value_f[0] - overdrawRamp[c].x) < 0.00005f &&
fabs(ret->value_f[1] - overdrawRamp[c].y) < 0.00005f &&
fabs(ret->value_f[2] - overdrawRamp[c].z) < 0.00005f)
{
ret->value_i[0] = (int32_t)c;
ret->value_i[1] = 0;
ret->value_i[2] = 0;
ret->value_i[3] = 0;
break;
}
}
}
return true;
}
示例15: TEST_F
TEST_F(TransactionTableTest, NormalOperations) {
const AccessMode is_lock_mode = AccessMode::IsLockMode();
const AccessMode x_lock_mode = AccessMode::XLockMode();
EXPECT_EQ(TransactionTableResult::kPlacedInOwned,
transaction_table_.putOwnEntry(tid_1_,
ResourceId(3),
is_lock_mode));
EXPECT_EQ(TransactionTableResult::kPlacedInPending,
transaction_table_.putPendingEntry(tid_1_,
ResourceId(5),
x_lock_mode));
}